<template>
	<view >
		<view class="m-tab">
			<view class="m-tab-item" :class="{'m-tab-active':current ==-1} " @click="clickTabFun(-1)">
				<text>全部</text>
			</view>
			<view class="m-tab-item" :class="{'m-tab-active':current ==index} " @click="clickTabFun(index)" v-for="(item,index) in list" :key="index">
				<text>{{item.channel_title}}</text> 
			</view>
		</view>
		
		<block v-for="(val,key) in list" :key="key">
			<block v-if="(current == -1 || current == key) && val.originalPic.length > 0">
				<view class="m-title">
					<text>{{val.channel_title}}({{val.originalPic.length}})</text>
				</view>
				<view class="m-list">
					<view class="m-item" @click="previewImageFun(val.originalPic,item)" v-for="(item,index) in val.originalPic" :key="index">
						<image :src="item" mode="aspectFill"></image>
					</view>
				</view>
			</block>
		</block>
		


	</view>
</template>

<script>
	import {previewImage} from "@/common/function/system_fun.js"
	export default {
		data() {
			return {
				list: [],
				current:-1
			};
		},
		onLoad(options) {
			this.getHotelPic(options.id)
		},
		methods: {
			clickTabFun(index){
				this.current = index
			},
			getHotelPic(id) { 
				this.$http.getJson('hotal_album',{id}).then(res=>{
					if(res.code == 1){
						let list = res.data.list || []
						this.list = list
						
					}
				})
			},
			previewImageFun(urls=[], current=0){
				previewImage(urls, current)
			},
		}
	}
</script>

<style lang="scss">
	.m-tab{
		display: flex;
		flex-wrap: wrap;
		padding: 30rpx 25rpx 20rpx;
		.m-tab-item{
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 0 20rpx;
			height: 68rpx;
			background: #F6F6F6;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			font-size: 24rpx;
			color: #222222;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
		}
		.m-tab-active{
			background: #D3A358;
			color: #fff;
		}
	}
	.m-title {
		display: flex;
		align-items: center;
		height: 80rpx;
		margin-left: 25rpx;
		font-size: 30rpx;
		font-weight: 800;
	}

	.m-list {
		display: flex;
		flex-wrap: wrap;

		.m-item {
			display: flex;
			position: relative;
			flex-direction: column;
			width: 330rpx;
			height: 330rpx;
			margin-left: 30rpx;
			margin-bottom: 30rpx;

			image {
				width: 100%;
				border-radius: 10rpx;
			}

			.m-item-text {
				position: absolute;
				bottom: 20rpx;
				left: 20rpx;
				font-size: 24rpx;
				color: #fff;
			}

			.m-item-more {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				position: absolute;
				width: 330rpx;
				height: 330rpx;
				border-radius: 10rpx;
				font-size: 24rpx;
				color: #fff;
				background: rgba($color: #000000, $alpha: 0.5);

				image {
					width: 32rpx;
					height: 32rpx;
				}
			}
		}
	}
</style>
